package com.wcgksoft.entity.order;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wcgksoft.entity.admin.Account;
import com.wcgksoft.entity.system.Enterprise;
import com.wcgksoft.entity.system.SysUser;
import org.hibernate.annotations.Cascade;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

/**
 * @author 御风
 * @version V1.0
 * @Package com.wcgksoft.entity
 * @Description TODO 订单表
 * @date 2020/5/16 14:30
 * @ClassName Order
 */
@Entity
@Table(name = "t_order")
public class Order {
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Integer id;

    /**
     * 订单编号 自动生成
     */
    @Column(name = "orderNo")
    private String orderNo;

    /**
     * 0 个人  1 企业
     */
    @Column(name = "identity")
    private String identity;

    /**
     * 购买人姓名
     */
    @Column(name = "buyName")
    private String buyName;

    /**
     * 省
     */
    @Column(name = "province")
    private String province;
    /**
     * 市
     */
    @Column(name = "city")
    private String city;

    /**
     * 县或区
     */
    @Column(name = "area")
    private String area;

    /**
     * 详细地址
     */
    @Column(name = "address")
    private String address;

    /**
     * 手机号码
     */
    @Column(name = "phone")
    private String phone;

    /**
    *微信号
     */
    @Column(name = "wxName")
    private String wxName;

    /**
     * 固定电话
     */
    @Column(name = "telephone")
    private String telephone;

    /**
     * 证件类型 0 身份证号 1 社会代码
     */
    @Column(name = "idType")
    private Integer idType;

    /**
     * 身份证号、社会代码
     */
    @Column(name = "idCardNo")
    private String idCardNo;

    /**
     * 开户行
     */
    @Column(name = "bankName")
    private String bankName;

    /**
     * 银行卡号
     */
    @Column(name = "bankNo")
    private String bankNo;

    /**
     * 用户类型
     */
    @Column(name = "userType")
    private String userType;



    /**
     * 审核状态 0 - 通过   1 - 财务审核  2 -管理审核  3 - 审核未通过
     */
    @Column(name = "status")
    private Integer status;


    /**
     * 删除状态 0 - 正常   1 - 删除
     */
    @Column(name = "deletetype")
    private Integer deletetype;

    /**
     * 总价
     */
    @Column(name = "totalPrice")
    private BigDecimal totalPrice;

    /**
     * 商品Id
     */
    @Column(name = "goodId")
    private String goodId;

    /**
     * 商品名称
     */
    @Column(name = "goodName")
    private String goodName;

    /**
     * 增值服务id
     */
    @Column(name = "serviceId")
    private String serviceId;

    /**
     * 驳回原因
     */
    @Lob
    @Column(name = "reason1")
    private String reason1;

    /**
     * 购买时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "buyTime")
    private Date buyTime;

    /**
     * 代理商id
     */
    @Column(name = "agentId")
    private Integer agentId;

    /**
     * 销售员id
     */
    @Column(name = "saleManId")
    private Integer saleManId;

    /*
    * 销售人员名称
    * */
    @Column(name = "accountname")
    private String accountname;


    /**
     * 关联订单详细表
     */

    //@JsonManagedReference
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "order")
    private Set<OrderDetails> detailsSet;
    /**
     * 企业id
     */
    @OneToOne(fetch = FetchType.EAGER, optional = true)
    @JoinColumn(name = "account", nullable = true)
    @Cascade({org.hibernate.annotations.CascadeType.REFRESH})
    private SysUser sysUser;

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public String getAccountname() {
        return accountname;
    }

    public void setAccountname(String accountname) {
        this.accountname = accountname;
    }

    public Integer getAgentId() {
        return agentId;
    }

    public void setAgentId(Integer agentId) {
        this.agentId = agentId;
    }

    public Integer getSaleManId() {
        return saleManId;
    }

    public void setSaleManId(Integer saleManId) {
        this.saleManId = saleManId;
    }

    public String getGoodName() {
        return goodName;
    }

    public void setGoodName(String goodName) {
        this.goodName = goodName;
    }

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public String getBuyName() {
        return buyName;
    }

    public void setBuyName(String buyName) {
        this.buyName = buyName;
    }

    public Date getBuyTime() {
        return buyTime;
    }

    public void setBuyTime(Date buyTime) {
        this.buyTime = buyTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getWxName() {
        return wxName;
    }

    public void setWxName(String wxName) {
        this.wxName = wxName;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Integer getIdType() {
        return idType;
    }

    public void setIdType(Integer idType) {
        this.idType = idType;
    }

    public String getIdCardNo() {
        return idCardNo;
    }

    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankNo() {
        return bankNo;
    }

    public void setBankNo(String bankNo) {
        this.bankNo = bankNo;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getGoodId() {
        return goodId;
    }

    public void setGoodId(String goodId) {
        this.goodId = goodId;
    }

    public String getServiceId() {
        return serviceId;
    }

    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    public Integer getDeletetype() {
        return deletetype;
    }


    public void setDeletetype(Integer deletetype) {
        this.deletetype = deletetype;
    }


    public String getReason1() {
        return reason1;
    }

    public void setReason1(String reason1) {
        this.reason1 = reason1;
    }

    public Set<OrderDetails> getDetailsSet() {
        return detailsSet;
    }

    public void setDetailsSet(Set<OrderDetails> detailsSet) {
        this.detailsSet = detailsSet;
    }
}
